<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
</head>
<body>
<div id="app">
    用户名:&nbsp;<input type="text" v-model="username"><br/>
    密&nbsp;&nbsp;码:&nbsp;<input type="password" v-model="password"><br/>
    <input @click="login" type="submit" value="登录">
</div>

<script>
    let app = new Vue({
        el: '#app',
        data: {
            username: '',
            password: ''
        },
        methods: {
            login() {
                console.log(1)
                let hr = {
                    username: this.username,
                    password: this.password
                }
                axios.post("http://localhost:80/login", hr).then(function (response) {
                    let data = response.data
                    if (data.flag) {
                        window.location.href = 'employeeList.html'
                    } else {
                        alert(data.msg)
                    }
                })
            }
        }
    })

</script>
</body>
</html>